package com.limbo.showapp.util;

import android.content.Context;

import cn.pedant.SweetAlert.SweetAlertDialog;

/**
 * Created by wangqi on 2018/9/13.
 */

public class SweetDialogManager {

    public static void showCacheClearDialog(final Context context){
        new SweetAlertDialog(context,SweetAlertDialog.WARNING_TYPE)
                .setTitleText("清除缓存")
                .setContentText("浏览过的缓存资源将会全部删除")
                .setConfirmText("删除")
                .setConfirmClickListener(new SweetAlertDialog.OnSweetClickListener() {
                    @Override
                    public void onClick(SweetAlertDialog sweetAlertDialog) {
                        CacheUtils.clearAllCache(context);

                        sweetAlertDialog.setTitleText("删除完成")
                                .showContentText(false)
                                .setConfirmText("OK")
                                .setConfirmClickListener(null)
                                .showCancelButton(false)
                                .changeAlertType(SweetAlertDialog.SUCCESS_TYPE);
                    }
                })
                .show();
    }
}
